home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 09, No. 04 (1988-04)(MicroSPARC)(Side A).zip
/
Nibble Volume 09, No. 04 (1988-04)(MicroSPARC)(Side A).po
/
EDITOR.OBJ.S
< prev
next >
Wrap
Text File
|
1996-12-24
|
13KB
|
521 lines
*______________________*
* *
* Proportional *
* PrintWorks *
* *
* Editor Module *
* EDITOR.OBJ *
*______________________*
* *
* Written by *
* Bob Thrasher *
* Copyright (C) 1987 *
* by MicroSPARC, INC *
* Concord, MA 01742 *
*______________________*
* *
* Created with *
* Merlin Pro *
*______________________*
* *
ORG $8000
ZPage1 EQU $00 ;Temp. zero page pointer
ZPage2 EQU $02 ; "
EndProp EQU $04 ;End of proportional set
COUTChar EQU $06 ;Parameter passer
DUM $300 ;User accessable parameter table
COUTVert DS 1
COUTHorL DS 1
COUTHorH DS 1
LeadingV DS 1
LeadingH DS 1
InvFlag DS 1
SPCWidth DS 1
PrintFlg DS 1
PageNum DS 1
FontNum DS 1
JMPCout DS 4
JMPHome DS 3
JMPGetK DS 3
FontSets DS 2
Temp1 DS 1
Temp2 DS 1
Temp3 DS 1
Temp4 DS 1
Index1 DS 1
Counter1 DS 1
DisTable DS 8
DEND
YHiresL EQU $9480 ;HIRES lookup tables
YHiresH EQU $9540
Table1 EQU $7000 ; (Width Table)
Table2 EQU Table1+$60 ; (Location pointers)
Table3 EQU Table2+$C0 ; (Actual data)
Table3b EQU $6000 ; (Char data: 8 byte)
* A couple of macros for conciseness and ease of reading.
Mov MAC
LDA ]1
STA ]2
<<<
Set MAC
Mov #<]2 ;]1
Mov #>]2 ;]1+1
<<<
Add MAC
LDA ]2
CLC
ADC ]1
STA ]2
<<<
EXP OFF
* A jump table for access to all routines from BASIC.
JMP Convert
JMP Clear
JMP CreateN
JMP UpVert
JMP Inverse
JMP Upside
JMP ShowSet
JMP Magnify
JMP Cursor
JMP Toggle
* Convert - This routine takes the non-proportional
* character set at (Table3b) and through a
* series of calculations transforms it into
* a proportional font stored at (Table1).
Convert Set ZPage1 ;Table3b ;Point ZPage1 to actual data
Mov #$00 ;Index1 ;Point Index1 to width table
Mov #$5F ;Counter1 ;Total of $5F characters
:1 Mov #$00 ;Temp1 ;Variable to check for blanks
LDY #$07 ;Index through bytes of char
:2 LDA (ZPage1),Y ;Get a byte
AND #$7F ;Remove high bit
STA (ZPage1),Y ;Replace in set
ORA Temp1 ;Mask onto running counter
STA Temp1
DEY ;Do all 8 bytes for each char
BPL :2
:3 LDA Temp1 ;First check for a blank
BEQ :5 ;Yes, so skip ahead
AND #$01 ;Is char already left justified?
BNE :5 ;Yes, so skip ahead
Mov #$00 ;Temp1 ;Now begin left shifting
LDY #$07 ;(all 8 bytes in sync)
:4 LDA (ZPage1),Y ;Get a byte
LSR ;Shift it left
STA (ZPage1),Y ;Replace in set
ORA Temp1 ;Again a running mask
STA Temp1
DEY ;Do all 8
BPL :4
BMI :3
:5 LDX #$07 ;Now determine width
Mov #$00 ;Temp1 ;Another temp mask variable
LDY #$07 ;Must check all 8 bytes
:6 LDA (ZPage1),Y ;Get a byte
ORA Temp1 ;Overlay with mask
STA Temp1
DEY ;Do them all
BPL :6
Mov #$40 ;Temp2 ;Start checking from right
:7 LDA Temp2
AND Temp1 ;Is there a pixel present here?
BNE :8 ;Yes, so the length is X-REG
ROR Temp2 ;No, so shift left 1 pixel
DEX ;Width decreases
BNE :7 ;And let's keep checking
:8 TXA
LDX Index1 ;Point to width table
STA Table1,X ;Place this width in table
Add #$08 ;ZPage1 ;Move ZPage1 to next char
BCC :9
INC ZPage1+1
:9 INC Index1 ;Move to next width position
DEC Counter1 ;Finished with all $5F chars?
BPL :1 ;No, so keep going
Set ZPage1 ;Table3b;Set ZPage1 to Non-prop table
Set ZPage2 ;Table3 ;Set ZPage2 to Prop table
Mov #$00 ;Counter1 ;Start at first char in table
Convert1 LDX Counter1
LDA Table1,X ;Get width
BEQ :5 ;If 0 then don't create data
STA Temp4 ;Save width
TXA
ASL
TAX
LDA ZPage2
SEC
SBC #<Table1
STA Table2,X ;Create index entry for data loc
INX
LDA ZPage2+1
SBC #>Table1
STA Table2,X
Mov #$01 ;Temp1 ;Start at left side of char
:1 Mov #$80 ;Temp2 ;Start at bottom w/ new data
Mov #$00 ;Temp3 ;Zero the temp data byte
LDY #$07 ;Eight bytes to be scanned
:2 LDA (ZPage1),Y ;Get the byte from non-prop set
AND Temp1 ;Is this bit set?
BEQ :3 ;No, so don't set a bit in data
LDA Temp2 ;Set a data bit
ORA Temp3
STA Temp3
:3 LSR Temp2 ;Shift one bit upward
DEY ;Do all 8 bytes
BPL :2
INY
Mov Temp3 ;(ZPage2),Y ;Put byte into final table
INC ZPage2 ;Move to next location
BNE :4
INC ZPage2+1
:4 ASL Temp1 ;Now move rightward to next byte
DEC Temp4 ;Decrement width loop register
BNE :1
:5 Add #$08 ;ZPage1 ;Move ahead to next char
BCC :6
INC ZPage1+1
:6 INC Counter1 ;Go until all chars processed
LDA Counter1
CMP #$60
BNE Convert1
Mov ZPage2 ;EndProp
Mov ZPage2+1 ;EndProp+1
RTS
* Clear - This section merely clears memory from
* $6000-$7FFF for initialization.
Clear Mov #$20 ;Temp1
Mov #$60 ;ZPage1+1
Mov #$00 ;ZPage1
TAY
:1 STA (ZPage1),Y
DEY
BNE :1
INC ZPage1+1
DEC Temp1
BNE :1
RTS
* CreateN - This code takes the character set displayed
* on-screen and creates a non-proportional
* character set at (Table3b)
CreateN Mov #$00 ;Temp1
STA Temp2
STA Temp3
Set ZPage1 ;Table3b
:1 Mov Temp3 ;Temp4
LDX #$07
:2 LDY Temp4
LDA YHiresL,Y
CLC
ADC Temp2
STA ZPage2
Mov YHiresH,Y ;ZPage2+1
LDY #$00
Mov (ZPage2),Y ;(ZPage1),Y
INC ZPage1
BNE :3
INC ZPage1+1
:3 INC Temp4
DEX
BPL :2
INC Temp2
INC Temp2
LDA Temp2
CMP #40
BNE :4
Mov #$00 ;Temp2
Add #10 ;Temp3
:4 INC Temp1
LDA Temp1
CMP #$60
BNE :1
RTS
* The following three routines are the editing options:
* UpVert - Scrolls the designated character one row up
* Inverse - Inverts the entire designated character
* Upside - Turns the specified character up-side down
UpVert Set Common2+1 ;UpVert1
JMP Common
Inverse Set Common2+1 ;Inverse1
JMP Common
Upside Set Common2+1 ;Upside1
Common Mov #$00 ;Temp1
STA Temp2
LDX #$5F
Common1 TXA
PHA
Common2 JSR $FFFF
INC Temp2
INC Temp2
LDA Temp2
CMP #40
BNE :1
Mov #$00 ;Temp2
Add #10 ;Temp1
:1 PLA
TAX
DEX
BPL Common1
JSR CreateN
JSR Convert
JMP ShowSet
UpVert1 LDY Temp1
INY
STY Temp3
DEY
JSR SetPg1Y
LDY Temp2
LDA (ZPage1),Y
PHA
LDX #$06
:1 LDY Temp3
Mov YHiresL,Y ;ZPage2
Mov YHiresH,Y ;ZPage2+1
LDY Temp2
Mov (ZPage2),Y ;(ZPage1),Y
Mov ZPage2 ;ZPage1
Mov ZPage2+1 ;ZPage1+1
INC Temp3
DEX
BPL :1
PLA
STA (ZPage2),Y
RTS
Inverse1 Mov Temp1 ;Temp3
LDX #$07
:1 LDY Temp3
JSR SetPg1Y
LDY Temp2
LDA (ZPage1),Y
EOR #$7F
STA (ZPage1),Y
INC Temp3
DEX
BPL :1
RTS
Upside1 Mov Temp1 ;Temp4
CLC
ADC #$07
STA Temp3
LDX #$03
:1 LDY Temp4
JSR SetPg1Y
LDY Temp3
Mov YHiresL,Y ;ZPage2
Mov YHiresH,Y ;ZPage2+1
LDY Temp2
LDA (ZPage1),Y
PHA
Mov (ZPage2),Y ;(ZPage1),Y
PLA
STA (ZPage2),Y
INC Temp4
DEC Temp3
DEX
BPL :1
RTS
* ShowSet - A small routine which displays the entire
* character set in a non-proportional fashion
* for clarity then displays a single line of
* sample character generation for viewing.
ShowSet Mov #$00 ;Temp1
STA Temp2
Mov #32 ;Temp3
LDA PrintFlg
PHA
Mov #$02 ;PrintFlg
:1 Mov Temp1 ;COUTHorH
Mov Temp2 ;COUTVert
Mov #$00 ;COUTHorL
LDA Temp3
JSR JMPCout
LDA #" "
JSR JMPCout
JSR JMPCout
INC Temp1
INC Temp1
LDA Temp1
CMP #40
BNE :2
Mov #$00 ;Temp1
Add #10 ;Temp2
:2 INC Temp3
LDA Temp3
CMP #$80
BNE :1
Mov #60 ;COUTVert
Mov #65 ;Temp4
Mov #$00 ;COUTHorH
STA COUTHorL
:3 LDA Temp4
BEQ :4
JSR JMPCout
CLC
ADC #32
JSR JMPCout
INC Temp4
LDA COUTHorH
CMP #36
BLT :3
:4 LDA #" "
JSR JMPCout
LDA COUTHorH
CMP #39
BGE :4
:5 PLA
STA PrintFlg
RTS
* Magnify - This section produces the magnified image of
* a specified character at the bottom left of
* the screen.
Magnify JSR Locate
Mov #132 ;COUTVert
Mov #$07 ;Temp2
:1 LDY Temp2
Mov (ZPage1),Y ;COUTChar
JSR :3
Mov #$06 ;Temp1
:2 LDA Temp1
TAY
CLC
ADC #$05
STA COUTHorH
Mov DisTable,Y ;COUTChar
JSR :5
DEC Temp1
BPL :2
LDA COUTVert
SEC
SBC #$07
STA COUTVert
DEC Temp2
BPL :1
RTS
:3 LDX #$07
:4 LDA #$80
AND COUTChar
STA DisTable,X
ASL COUTChar
DEX
BPL :4
RTS
:5 LDA COUTChar
BEQ :6
LDA #$07
:6 CLC
ADC #<DotTable
STA :8+1
LDA #>DotTable
ADC #$00
STA :8+2
LDX #$06
LDY COUTVert
:7 LDA YHiresL,Y
CLC
ADC COUTHorH
STA :9+1
Mov YHiresH,Y ;:9+2
:8 LDA $FFFF
:9 STA $FFFF
INC :8+1
BNE :0
INC :8+2
:0 INY
DEX
BPL :7
RTS
* Cursor - This is the keypress routine which flashes the
* HIRES cursor until a key is pressed then
* returns control to BASIC.
Cursor JSR :2
JSR :4
BCS :1
JSR :2
JSR :4
BCC Cursor
RTS
:1 JSR :2
RTS
:2 LDX COUTVert
Mov COUTChar ;Temp1
:3 Mov YHiresL,X ;ZPage1
Mov YHiresH,X ;ZPage1+1
LDY COUTHorH
LDA #$7F
EOR (ZPage1),Y
STA (ZPage1),Y
INX
DEC Temp1
BNE :3
RTS
:4 LDX #$00
:5 LDA $C000
BMI :6
DEX
BNE :5
CLC
RTS
:6 SEC
RTS
* Toggle - Toggles the status of particular bits of the
* character as required by the editor.
Toggle JSR Locate
LDY COUTHorH
LDA BitTable,Y
LDY COUTVert
EOR (ZPage1),Y
STA (ZPage1),Y
JMP Magnify
* Locate - This routine sets ZPage1 to point to the
* specified character in Table3b (the non-prop.
* table) for further indexed access.
Locate Set ZPage1 ;Table3b
LDX COUTChar
BEQ :3
:1 Add #$08 ;ZPage1
BCC :2
INC ZPage1+1
:2 DEX
BNE :1
:3 RTS
* SetPg1Y - A tiny subroutine for code size optimization.
SetPg1Y Mov YHiresL,Y ;ZPage1
Mov YHiresH,Y ;ZPage1+1
RTS
BitTable HEX 01020408102040 ;Bit mask table
DotTable HEX 0000081C080000 ;Magnify characters
HEX 3E7F7F7F7F7F3E